package org.com.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.com.pojo.Transactions;
import org.com.service.TransactionsService;
import org.com.mapper.TransactionsMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 86134
* @description 针对表【transactions】的数据库操作Service实现
* @createDate 2025-03-04 20:23:49
*/
@Service
public class TransactionsServiceImpl extends ServiceImpl<TransactionsMapper, Transactions>
    implements TransactionsService{

    @Override
    public List<Transactions> getUserTransactions(Integer userId, Long balanceId) {
        QueryWrapper<Transactions> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId)
                   .orderByDesc("created_at"); // 按时间倒序排列
        return this.list(queryWrapper);
    }
}




